#include <stdio.h>
#include <stdlib.h>
#include <csp_spu.h>
#include <csp_debug.h>

int global_pid; 


int Run(){
	int pid = csp_pid();

	global_pid = csp_pid();


	char *printf_yield_task = "printf_yield_task";

	csp_process mnemonics[] = {
		csp_create_process(printf_yield_task),
		csp_create_process(printf_yield_task),
		csp_create_process(printf_yield_task),
		csp_create_process(printf_yield_task),
		csp_create_process(printf_yield_task),
		csp_create_process(printf_yield_task) };

	csp_run_parallel(mnemonics, 6);


	printf("******* After parallel!\n");

	ASSERT( pid == csp_pid() );
	ASSERT( global_pid == csp_pid() );
	
	PRINTF_FOR_TESTING("cplusplus_task terminating on spe #%i with pid %i\n", csp_spe_id(), pid);
	return 42;
}
